﻿using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using TL_Cloud.Core.Entities;

namespace TL_Cloud.Core.Interfaces
{
    /// <summary>
    /// 公共的基础数据接口
    /// </summary>
    /// <typeparam name="T">BaseEntity的派生类</typeparam>
    /// <typeparam name="S">QueryParameters的派生类</typeparam>
    public interface IBaseInterface<T, S>
        where T : BaseEntity
        where S : QueryParameters
    {

        /// <summary>
        /// 获取所有数据
        /// </summary>
        /// <param name="queryParameters"></param>
        /// <returns></returns>
        Task<PaginatedList<T>> GetAllEntitiesAsync(S queryParameters);
        /// <summary>
        /// 获取单个实体
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        Task<T> GetEntityByIdAsync(string id);
        /// <summary>
        /// 增加实体
        /// </summary>
        /// <param name="post"></param>
        void Add(T post);
        /// <summary>
        /// 删除实体
        /// </summary>
        /// <param name="post"></param>
        void Delete(T post);
        /// <summary>
        /// 更新实体
        /// </summary>
        /// <param name="post"></param>
        void Update(T post);
    }


    /// <summary>
    /// 公共的基础数据接口
    /// </summary>
    /// <typeparam name="T">BaseEntity的派生类</typeparam>
    /// <typeparam name="S">QueryParameters的派生类</typeparam>
    public interface IBaseInterface<T>
        where T : BaseEntity
    {

        /// <summary>
        /// 获取所有数据
        /// </summary>
        /// <param name="queryParameters"></param>
        /// <returns></returns>
        Task<PaginatedList<T>> GetAllEntitiesAsync();
        /// <summary>
        /// 获取单个实体
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        Task<T> GetEntityByIdAsync(string id);
        /// <summary>
        /// 增加实体
        /// </summary>
        /// <param name="post"></param>
        void Add(T post);
        /// <summary>
        /// 删除实体
        /// </summary>
        /// <param name="post"></param>
        void Delete(T post);
        /// <summary>
        /// 更新实体
        /// </summary>
        /// <param name="post"></param>
        void Update(T post);


    }
}